package de.sup.scs.prototyp.client.ui.graphic.walmdach;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ContentSlot;
import com.gwtplatform.mvp.client.annotations.NameToken;
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
import com.gwtplatform.mvp.client.proxy.ProxyPlace;
import com.gwtplatform.mvp.client.proxy.RevealContentEvent;
import com.gwtplatform.mvp.client.proxy.RevealContentHandler;
import de.sup.scs.prototyp.client.ui.main.MainPagePresenter;
import de.sup.scs.prototyp.client.ui.toolbox.ToolBoxPresenter;

public class GraphicWDPresenter extends Presenter<GraphicWDPresenter.MyView, GraphicWDPresenter.MyProxy>{

    @ContentSlot
    public static final Type<RevealContentHandler<?>> TOOLBOX = new Type<RevealContentHandler<?>>();

    @ProxyCodeSplit
    @NameToken("graphicWD")
    public interface MyProxy extends ProxyPlace<GraphicWDPresenter> {}

    public interface MyView extends View {}

    private final ToolBoxPresenter toolBoxPresenter;

    @Inject
    public GraphicWDPresenter(EventBus eventBus, MyView view, MyProxy proxy, ToolBoxPresenter toolBoxPresenter) {
        super(eventBus, view, proxy);
        this.toolBoxPresenter = toolBoxPresenter;
    }

    @Override
    protected void revealInParent() {
        RevealContentEvent.fire(this, MainPagePresenter.CONTENT, this);
    }

    @Override
    protected void onReveal(){
        super.onReveal();
        setInSlot(TOOLBOX, toolBoxPresenter);
    }
}